package string;

import java.util.Scanner;

public class StringTest2 {
    public static void main(String[] args) {
        String username = "admin";
        String passWord = "123456";
        String checkWord = "G7Y5";
        Scanner sc = new Scanner(System.in);

        for (int i = 0; i < 3; i++) {
            System.out.println("请您输入您的账号:");
            String uName = sc.nextLine();
            System.out.println("请您输入您的密码:");
            String pwd = sc.nextLine();
            System.out.println("请您输入验证码(G7Y5):");
            String cWord = sc.nextLine();

            if (username.equals(username)  &&  passWord.equals(pwd) && checkWord.equalsIgnoreCase(cWord)) {
                System.out.println("恭喜你, 登录成功!");
                break;
            }else {
                if (i==2){
                    System.out.println("您已经连续3次输入错误,您的账号被锁定,请联系管理员~");
                    break;
                }
            }
            System.out.println("您的账号密码或者验证码输入有误,请确认后再来! 您还有"+(2 - i)+"次机会登录~");


        }
    }
}
